package com.zhuss.controller.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.permission.CareResourcePermissionListBo;
import com.zhuss.bean.bo.core.resource.DetailResourceBo;
import com.zhuss.bean.bo.core.resource.ListMenuTreeBo;
import com.zhuss.bean.bo.core.resource.ListResourceTreeBo;
import com.zhuss.bean.bo.core.resource.SearchResourceBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.core.menu.ResourceReadServiceExt;
import com.zhuss.exception.AabException;


/**
 * 菜单资源点查询 controller
 * @Author zhushanshuo
   @Date 2019-11-27 19:58
 *
 */
  
 
@RestController
@RequestMapping("/resource")
public class ResourceReadController extends BaseController {
	
	@Autowired
	@Qualifier("resourceReadService")
	private ReadService<Object, Object> resourceReadService;
	
	@Autowired
	@Qualifier("resourceReadServiceExt")
	private ResourceReadServiceExt resourceReadServiceExt;
	
	/**
	 * 详情
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/detail")
    public Object detail(@RequestBody DetailResourceBo bo) throws AabException {
		
		Object result = resourceReadService.detail(bo);
		return result;
    }
	
	/**
	 * 列表
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchResourceBo bo) throws AabException {
		
		Object result = resourceReadService.list(bo);
		return result;
    }
	
	/**
	 * 菜单树
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/listMenuTree")
    public Object listMenuTree(@RequestBody ListMenuTreeBo bo) throws AabException {
		
		Object result = resourceReadServiceExt.listMenuTree(bo);
		return result;
    }
	
	
	/**
	 * 菜单资源混合树
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/listResourceTree")
    public Object listResourceTree(@RequestBody ListResourceTreeBo bo) throws AabException {
		
		Object result = resourceReadServiceExt.listResourceTree(bo);
		return result;
    }
	
	
	/**
	 * 查询菜单资源的权限树
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/careResourcePermissionList")
    public Object careResourcePermissionList(@RequestBody CareResourcePermissionListBo bo) throws AabException {
		
		Object result = resourceReadServiceExt.careResourcePermissionList(bo);
		return result;
    }


	
}
